package com.pureland.common.exception;


/**
 * @projectName: pureland_cloud
 * @className: com.pureland.common.exception.BaseUncheckedException
 * @description: 非运行期异常基类，所有自定义非运行时异常继承该类
 * @author: tong.li
 * @createTime: 2020/9/26 17:46
 * @version: v1.0
 * @copyright: 版权所有 李彤 © 2020
 * @see RuntimeException,BaseException
 */
public class BaseUncheckedException extends RuntimeException implements BaseException {

    private static final long serialVersionUID = -778887391066124051L;

    /**
     * 异常信息
     */
    protected String message;

    /**
     * 具体异常码
     */
    protected int code;

    public BaseUncheckedException(int code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public BaseUncheckedException(int code, String format, Object... args) {
        super(String.format(format, args));
        this.code = code;
        this.message = String.format(format, args);
    }


    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public int getCode() {
        return code;
    }
}
